<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box1 {
        width: 300px;
        height: 300px;
        background-color: red;
      }
      .box2 {
        width: 200px;
        height: 200px;
        background-color: yellow;
      }
      .box3 {
        width: 100px;
        height: 100px;
        background-color: green;
      }
    </style>
  </head>
  <body>
    <div class="box1">
      <div class="box2">
        <div class="box3"></div>
      </div>
    </div>
    <script>
      var box1Ele = document.querySelector(".box1");
      var box2Ele = document.querySelector(".box2");
      var box3Ele = document.querySelector(".box3");

      box1Ele.addEventListener("click", function () {
        console.log(1);
      });
      box2Ele.addEventListener("click", function () {
        console.log(2);
      });
      box3Ele.addEventListener("click", function () {
        console.log(3);
      });
    </script>
  </body>
</html>
